package com.ruoyi.blindBoxManage.mapper;

import com.ruoyi.blindBoxManage.domain.BlindBoxProduct;
import com.ruoyi.blindBoxManage.domain.BlindBoxPublicProduct;
import com.ruoyi.common.vo.IndexProfitData;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 盲盒商品Mapper接口
 * 
 * @author ruoyi
 * @date 2025-08-12
 */
public interface BlindBoxProductMapper 
{
    /**
     * 查询盲盒商品
     * 
     * @param id 盲盒商品主键
     * @return 盲盒商品
     */
    public BlindBoxProduct selectBlindBoxProductById(Long id);

    /**
     * 查询盲盒商品列表
     * 
     * @param blindBoxProduct 盲盒商品
     * @return 盲盒商品集合
     */
    public List<BlindBoxProduct> selectBlindBoxProductList(BlindBoxProduct blindBoxProduct);

    /**
     * 新增盲盒商品
     * 
     * @param blindBoxProduct 盲盒商品
     * @return 结果
     */
    public int insertBlindBoxProduct(BlindBoxProduct blindBoxProduct);

    /**
     * 修改盲盒商品
     * 
     * @param blindBoxProduct 盲盒商品
     * @return 结果
     */
    public int updateBlindBoxProduct(BlindBoxProduct blindBoxProduct);

    /**
     * 删除盲盒商品
     * 
     * @param id 盲盒商品主键
     * @return 结果
     */
    public int deleteBlindBoxProductById(Long id);

    /**
     * 批量删除盲盒商品
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteBlindBoxProductByIds(Long[] ids);

    Integer updateBanch(BlindBoxPublicProduct blindBoxPublicProduct);

    @Select("select count(*) from t_blind_box_product where blind_box_id = #{blindBoxId}")
    Integer selectCountByBlindBoxId(@Param("blindBoxId") Long blindBoxId);
    @Select("select count(*) from t_blind_box_product where box_id = #{boxId}")
    Integer selectCountByBoxId(@Param("boxId") Long boxId);

    @Select("select count(*) from t_blind_box_product where class_id = #{classId}")
    Integer selectCountByClassId(@Param("classId") Integer classId);

    @Select("select count(*) from t_blind_box_product  where product_type_id = #{productTypeId}")
    Integer selectCountByProductTypeId(@Param("productTypeId") Integer productTypeId);

    @Select("select * from t_blind_box_product where blind_box_id is null and box_id is null ")
    List<BlindBoxProduct> selectNotBlindList();

    @Select("select count(*) from t_blind_box_product where public_product_id = #{publicProductId}")
    Integer selectCountByPublicProductId(@Param("publicProductId") Long publicProductId);

    IndexProfitData selectProfitData();

    List<BlindBoxProduct> selectProductListByBlidBoxId(@Param("blindBoxId") Long blindBoxId);

    List<BlindBoxProduct> selectProductListByBlidBoxIdAndBoxName(@Param("blindBoxId") Long blindBoxId);

    List<BlindBoxProduct> selectList(@Param("id") Long id);
    List<BlindBoxProduct> selectBlindList(@Param("publicProductId") Long publicProductId,@Param("blindBoxId") Long blindBoxId);

    List<BlindBoxProduct> selectProductListsByBlidBoxId(@Param("blindBoxId")Long blindBoxId);

    @Delete("delete from t_blind_box_product where box_id = #{boxId}")
    Integer deleteByBoxId(@Param("boxId") Long boxId);
}
